<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作用域插槽——具名插槽</title>
</head>
<body>
<div id="app">
  <cpn></cpn>
  <hr>

  <cpn>
    <template v-slot:cpn="scope">
      <div>{{ scope.message }}</div>
    </template>
  </cpn>

  <cpn>
    <template #cpn="scope">
      <div>{{ scope.message }}</div>
    </template>
  </cpn>
</div>

<template id="cpn">
  <h1>Hello, World!</h1>
  <slot name="cpn" message="Hello, Vue">

  </slot>
  <h2>欢迎来到陕西交通职业技术学院</h2>
</template>

<script type="module">
  import {createApp, defineComponent} from "../../../js/vue.esm-browser.js";

  let component = defineComponent(
          {
            template:"#cpn",
          }
  );

  let app = createApp(
          {
            setup() {
              return {}
            }
          }
  );

  app.component("cpn", component)

  app.mount("#app")
</script>
</body>
</html>